home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15486 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.9 KB  |  63 lines

  1. Path: brookes.ac.uk!news
  2. From: Krunchie <95155580@brookes.ac.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Trapping Ctrl-Alt-Del
  5. Date: 19 Apr 1996 09:42:21 GMT
  6. Organization: Digital Dynamics Unlimited
  7. Message-ID: <4l7n5t$bse@cs3.brookes.ac.uk>
  8. References: <4kqh5e$fap@ms.slip.net>
  9. NNTP-Posting-Host: rm003b4a.brookes.ac.uk
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
  14.  
  15. mavrick@slip.net (Mavrick) wrote:
  16. >I am running a network of 50 pcs in a class room where students always
  17. >manage to bypass the provided computer curriculum program by rebooting
  18. >(Ctrl-Alt-Del) their way out, and fool around the hard disks.  Some
  19. >also found out that Ctrl-C or Ctrl-break would do the same trick.  I
  20. >need to fine tune the menu program I wrote 2 years ago and  implement
  21. >a keyboard trapping algorithm to weed out the Ctrl-Alt-Del and Ctrl-C
  22. >/Ctrl-break.  Any other keys I can easily trap by scanning for their
  23. >scan codes; however, those 3 combos work differrently. 
  24. >
  25. >Could someone write me a short program in C / C++ that would do the
  26. >trick.  Something as simple as printing 'Hello' every time any of
  27. >those combos are pressed.  Perhaps I could return the favor by
  28. >inviting you for lunch should you ever come across the Bay Area
  29. >(Northern California).  Thank You.  Marvick W C
  30. >
  31. >mavrick@slip.net
  32. >
  33.  
  34. If you are using the Turbo C compiler then you can implement this bit of 
  35. code to stop control break from terminating the program (this is not 
  36. checked!!):
  37.  
  38.  
  39.  
  40. int ctrl_break(void);
  41.  
  42. int main()
  43. {
  44. ctrlbrk(ctrl_break);
  45. .
  46. . /* Rest of your program */
  47. .
  48. }
  49.  
  50. int ctrl_break(void)
  51. {
  52. main();
  53. return 0;
  54. }
  55.  
  56. I don't know how you can disable Ctrl-Alt-Del, I'd like to know myself, 
  57. however couldn't you set up the machines so that your program executes on 
  58. boot up, disabling various bios options so that your students can't 
  59. bypass this?
  60.  
  61. Krunchie
  62.  
  63.